﻿namespace WoWArmoryParser
{
    public class ArenaTeam
    {
        internal ArenaTeam()
        {
            _WeekGames = new GamesInfo();
            _SeasonGames = new GamesInfo();
            _Members = new ArenaTeamMemberCollection();
            _Emblem = new ArenaEmblem();
        }

        protected RegionEnum _Region;
        protected string _BattleGroup;
        protected FactionEnum _Faction;
        protected string _Realm;
        protected string _Name;
        protected ArenaTeamSizeEnum _Size;
        protected int _Ranking;
        protected int _Rating;
        protected GamesInfo _WeekGames;
        protected GamesInfo _SeasonGames;
        protected ArenaTeamMemberCollection _Members;
        protected ArenaMember _Leader;
        protected ArenaEmblem _Emblem;

        public RegionEnum Region
        {
            get { return _Region; }
            internal set { _Region = value; }
        }

        public string BattleGroup
        {
            get { return _BattleGroup; }
            internal set { _BattleGroup = value; }
        }

        public FactionEnum Faction
        {
            get { return _Faction; }
            internal set { _Faction = value; }
        }

        public string Realm
        {
            get { return _Realm; }
            internal set { _Realm = value; }
        }

        public string Name
        {
            get { return _Name; }
            internal set { _Name = value; }
        }

        public ArenaTeamSizeEnum Size
        {
            get { return _Size; }
            internal set { _Size = value; }
        }

        public int Ranking
        {
            get { return _Ranking; }
            internal set { _Ranking = value; }
        }

        public int Rating
        {
            get { return _Rating; }
            internal set { _Rating = value; }
        }

        public GamesInfo GamesInWeek
        {
            get { return _WeekGames; }
        }

        public GamesInfo GamesInSeason
        {
            get { return _SeasonGames; }
        }

        public ArenaTeamMemberCollection Members
        {
            get { return _Members; }
        }

        public ArenaMember Leader
        {
            get
            {
                if (_Leader != null)
                {
                    return _Leader;
                }
                else
                {
                    throw new ArenaTeamLeaderNotFoundException();
                }
            }
            internal set { _Leader = value; }
        }

        public ArenaEmblem Emblem
        {
            get { return _Emblem; }
        }

        public System.Uri ArmoryWebPath
        {
            get { return new Uri(string.Format("{0}/team-info.xml?r={1}&t={2}&ts={3}", ArmoryParser.GetRegionPath(_Region), _Realm, _Name, (int)_Size)); }
        }
    }


    public class ArenaEmblem
    {
        internal ArenaEmblem()
        {

        }

        protected string _BackgroundColor;
        protected string _BorderColor;
        protected int _BorderStyle;
        protected string _IconColor;
        protected int _IconStyle;

        public string BackgroundColor
        {
            get { return _BackgroundColor; }
            internal set { _BackgroundColor = value; }
        }

        public string BorderColor
        {
            get { return _BorderColor; }
            internal set { _BorderColor = value; }
        }

        public string IconColor
        {
            get { return _IconColor; }
            internal set { _IconColor = value; }
        }

        public int BorderStyle
        {
            get { return _BorderStyle; }
            internal set { _BorderStyle = value; }
        }

        public int IconStyle
        {
            get { return _IconStyle; }
            internal set { _IconStyle = value; }
        }
    }
}
